<template>
  <div class="app-container">
    <div class="chart_box">
      <div class="chart_item" ref="Rankstatistics"></div>
      <div class="chart_item" ref="Typestatistics"></div>
      <div class="chart_item" ref="Layerstatistics"></div>
      <div class="chart_item" ref="Areastatistics"></div>
      <div class="chart_item" ref="Towardstatistics"></div>
      <div class="chart_item" ref="Alonestatistics"></div>
    </div>
    <!-- <div class="map_box">
      地图展示区域
    </div> -->
  </div>
</template>

<script>
import * as echarts from 'echarts';
export default {
  name: "multi_dimensional",
  data() {
    return {

    }
  },
  mounted() {
    // 等级统计
    this.RankstatisticsInit()
    // 类型统计
    this.TypestatisticsInit()
    // 层数统计
    this.LayerstatisticsInit()
    // 面积统计
    this.AreastatisticsInit()
    // 朝向统计
    this.TowardstatisticsInit()
    // 独卫统计
    this.AlonestatisticsInit()
  },
  methods: {
    RankstatisticsInit() {
      const myChart = echarts.init(this.$refs.Rankstatistics);
      const option = {
        title: {
          //   text: '',
          subtext: '等级统计',
          left: 'center'
        },
        tooltip: {
          trigger: 'item',
        },
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '50%',
            data: [
              { value: 1048, name: 'Search Engine' },
              { value: 735, name: 'Direct' },
              { value: 580, name: 'Email' },
              { value: 484, name: 'Union Ads' },
              { value: 300, name: 'Video Ads' }
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };
      option && myChart.setOption(option);
      window.addEventListener('resize', () => { myChart.resize() });
    },
    TypestatisticsInit() {
      const myChart = echarts.init(this.$refs.Typestatistics);
      const option = {
        title: {
          //   text: '',
          subtext: '类型统计',
          left: 'center'
        },
        tooltip: {
          trigger: 'item',
        },
        color: ['#5470c6', '#91cc75', '#fc8452'],
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '50%',
            data: [
              { value: 1048, name: 'Search Engine' },
              { value: 735, name: 'Direct' },
              { value: 580, name: 'Email' },
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };
      option && myChart.setOption(option);
      window.addEventListener('resize', () => { myChart.resize() });
    },
    LayerstatisticsInit() {
      const myChart = echarts.init(this.$refs.Layerstatistics);
      const option = {
         title: {
          //   text: '',
          subtext: '层数统计',
          left: 'center'
        },
        xAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: 'bar',
            showBackground: true,
            backgroundStyle: {
              color: 'rgba(180, 180, 180, 0.2)'
            }
          }
        ]
      };

      option && myChart.setOption(option);
      window.addEventListener('resize', () => { myChart.resize() });
    },
    AreastatisticsInit() {
      const myChart = echarts.init(this.$refs.Areastatistics);
      const option = {
         title: {
          //   text: '',
          subtext: '面积统计',
          left: 'center'
        },
        xAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [120, 5000, 150, 80, 70, 110, 130],
            type: 'bar',
            showBackground: true,
            backgroundStyle: {
              color: 'rgba(180, 180, 180, 0.2)'
            }
          }
        ]
      };

      option && myChart.setOption(option);
      window.addEventListener('resize', () => { myChart.resize() });
    },
    TowardstatisticsInit(){
      const myChart = echarts.init(this.$refs.Towardstatistics);
      const option = {
         title: {
          //   text: '',
          subtext: '朝向统计',
          left: 'center'
        },
        xAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: 'bar',
            showBackground: true,
            backgroundStyle: {
              color: 'rgba(180, 180, 180, 0.2)'
            }
          }
        ]
      };

      option && myChart.setOption(option);
      window.addEventListener('resize', () => { myChart.resize() });
    },
    AlonestatisticsInit() {
      const myChart = echarts.init(this.$refs.Alonestatistics);
      const option = {
        title: {
          //   text: '',
          subtext: '独卫统计',
          left: 'center'
        },
        tooltip: {
          trigger: 'item',
        },
        color: ['#5470c6', '#91cc75', '#fc8452'],
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '50%',
            data: [
              { value: 1048, name: 'Search Engine' },
              { value: 735, name: 'Direct' },
              { value: 580, name: 'Email' },
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };
      option && myChart.setOption(option);
      window.addEventListener('resize', () => { myChart.resize() });
    },
  }
}
</script>

<style lang="scss" scoped>
.app-container {
 height: calc(100vh - 50px);
  display: flex;
  flex-direction: row;
  .chart_box {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    .chart_item {
      // width: calc((100% - 10px) / 3);
      width: calc(100% / 3);
      // margin: 0px 10px 10px 0px;
      padding-top: 10px;
      height: calc((100% - 70px) / 2);

      // &:nth-child(2n + 2) {
      //   margin-right: 0px;
      // }
    }
  }

  // .map_box {
  //   width: 50%;
  // }
}
</style>